import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mybaseplus/base/tool/device/DeviceDirection.dart';
import 'package:mybaseplus/base/tool/platformUtils/FFPlatform.dart';
import 'package:mybaseplus/base/tool/sp/FFSpUtils.dart';
import 'package:mybaseplus_example/bloc/userbloc/user_bloc.dart';
import 'package:mybaseplus_example/mainApp.dart';

Future<void> main() async {
  /// 绑定引擎
  WidgetsFlutterBinding.ensureInitialized();

  ///初始化sp
  await FFSpUtils.init();

  /// 设置状态条
  if (FFPlatform.isAndroid) {
    SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent, statusBarIconBrightness: Brightness.light);
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }

  /// 强制竖屏
  DeviceDirection.portrait();

  ///数据共享配置
  runApp(MultiBlocProvider(
    providers: [
      BlocProvider<UserBloc>(create: (context) => UserBloc()),
    ],
    child: MyApp(),
  ));
}

